﻿/*----------------------------------------------------------------
//  <copyright file="IEntityRoleStore.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2022-12-21 11:41</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Authorization
{
    #region "定义实体角色信息存储"
    /// <summary>
    /// 定义实体角色信息存储
    /// </summary>
    public interface IEntityRoleStore<TEntityRole, in TEntityRoleInputDto, in TRoleKey>
    {
        #region "属性"
        #region "获取 实体角色信息查询数据集"
        /// <summary>
        /// 获取 实体角色信息查询数据集
        /// </summary>
        IQueryable<TEntityRole> EntityRoles { get; }
        #endregion

        #endregion

        #region "方法"
        #region "检查实体角色信息是否存在"
        /// <summary>
        /// 检查实体角色信息是否存在
        /// </summary>
        /// <param name="predicate">检查谓语表达式</param>
        /// <param name="id">实体角色信息编号</param>
        /// <returns>实体角色信息是否存在</returns>
        Task<bool> CheckEntityRoleExists(Expression<Func<TEntityRole, bool>> predicate, long id = default);
        #endregion
        #region "获取指定角色和实体的过滤条件组"
        /// <summary>
        /// 获取指定角色和实体的过滤条件组
        /// </summary>
        /// <param name="roleId">角色编号</param>
        /// <param name="entityId">实体编号</param>
        /// <param name="operation">操作</param>
        /// <returns>过滤条件组</returns>
        FilterGroup[] GetEntityRoleFilterGroups(TRoleKey roleId, long entityId, DataAuthOperation operation);
        #endregion
        #region "添加实体角色信息"
        /// <summary>
        /// 添加实体角色信息
        /// </summary>
        /// <param name="dtos">要添加的实体角色信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> CreateEntityRoles(params TEntityRoleInputDto[] dtos);
        #endregion
        #region "更新实体角色信息"
        /// <summary>
        /// 更新实体角色信息
        /// </summary>
        /// <param name="dtos">包含更新信息的实体角色信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> UpdateEntityRoles(params TEntityRoleInputDto[] dtos);
        #endregion
        #region "删除实体角色信息"
        /// <summary>
        /// 删除实体角色信息
        /// </summary>
        /// <param name="ids">要删除的实体角色信息编号</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> DeleteEntityRoles(params long[] ids);
        #endregion

        #endregion

    }
    #endregion

}
